package com.jiangli.mapper;



import com.github.pagehelper.Page;

import com.jiangli.dto.UserPageQueryDTO;
import com.jiangli.entity.User;
import com.jiangli.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 创建新注册用户
     * @param user
     */
//    @AutoFill(OperationType.INSERT)
//    void insertQQ(User user);
    /**
     * 通过qq邮箱检索 用户是否存在
     * @param email
     * @return
     */
    @Select("select * from qq_user where qq=#{qq}")
    User selectByemail(String email);

    @Select("select * from wx_user where openid=#{openid}")
    User getByOpenid(String openid);

    @Select("select id,openid,username,status,flavor_preference,age,height,weight,sex,create_time from wx_user where id=#{id};")
    User getById(Long id);
    /**
     *
     * @param user
     */

    void update(@Param("user") User user);

    @Select("select * from qq_user where qq=#{qq}")
    User getByQq(String qq);


    int  insertwx(User user);

    @Select("select id,username,status,age,create_time form wx_user")
    List<User> getAllUsers();

    Page pageQuery(UserPageQueryDTO userPageQueryDTo);
}
